<template>
  <div class="dashboard">
    <el-row :gutter="20">
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>总用户数</span>
            </div>
          </template>
          <div class="card-value">
            {{ stats.userCount || 0 }}
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>今日测评数</span>
            </div>
          </template>
          <div class="card-value">
            {{ stats.todayEvaluations || 0 }}
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>待处理咨询</span>
            </div>
          </template>
          <div class="card-value">
            {{ stats.pendingConsultations || 0 }}
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>在线专家</span>
            </div>
          </template>
          <div class="card-value">
            {{ stats.onlineExperts || 0 }}
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import request from '../../utils/request'

const stats = ref({})

onMounted(async () => {
  try {
    // 这里先用模拟数据，后续对接后端API
    stats.value = {
      userCount: 100,
      todayEvaluations: 25,
      pendingConsultations: 5,
      onlineExperts: 3
    }
  } catch (error) {
    console.error('Failed to fetch dashboard stats:', error)
  }
})
</script>

<style scoped>
.dashboard {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-value {
  font-size: 28px;
  font-weight: bold;
  color: #409EFF;
  text-align: center;
  padding: 20px 0;
}

.el-card {
  margin-bottom: 20px;
}
</style> 